def text = textArea.text
text = text.replaceAll(/(?<=<)(?ms).+?(?=>)/){
    it.replaceAll(/^\w+/){
        it.toLowerCase()
    }.replaceAll(/(?<=\s+)[a-zA-Z0-9\-]+(?==)/){
        it.toLowerCase()
    }
}.replaceAll(/(?<=<)\/?\w+(?=>)/){
    it.toLowerCase()
}
textArea.text = text